<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cpanel extends CI_Controller {
    
    public function __construct(){
        parent::__construct();
        if (!$this->session->userdata('logged_in')) {
            redirect('login');exit;
        }
        else{
            $componente = array('componente'=>'cpanel');
            $this->session->set_userdata($componente);
        }
    }
    public function index(){
        if(!$this->session->userdata('componente')){
            echo "Componente indefinido!";
        }else{
            $componente = $this->session->userdata('componente').'_view';    
            $this->load->view('layout/header_view',$componente);
            $this->load->view('menu_view');
            $this->load->view($componente);
            $this->load->view('layout/footer_view');
        }
    }
}

